﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace IllustratedCsharp7_ch9
{
    class chapt10_10UsingStatement
    {
        static void _Main()
        {
            //using语句
            using (TextWriter tw = File.CreateText("Lincoln.txt"))
            {
                tw.WriteLine("Four score and seven years ago,...");
            }

            //using语句
            using (TextReader tr = File.OpenText("Lincoln.txt"))
            {
                string InputString;
                while (null != (InputString = tr.ReadLine()))
                    Console.WriteLine(InputString);
            }
        }
    }
}
